package org.jmpo;

import java.util.Comparator;

public record Student (long id, String name) { 
    public static final class NameComparator implements Comparator<Student> {
        @Override
        public int compare(Student lha, Student rha) {
            return lha.name.compareTo(rha.name);
        }
    }

    public static final class Builder {
        public Builder() {
            this.id = 0;
            this.name = "";
        }

        public Builder withName(String name) {
            this.name = name;
            return this;
        }

        public Builder withId(long id) {
            this.id = id;
            return this;
        }

        public Student build() {
            return new Student(this.id, this.name);
        }

        private long id;
        private String name;
    }
}